package pl.koziolekweb.solid.lsp;

public class App {
	public static void main(String[] args) {
		// kod użytkownika
		String abc = "abc";
		TextFilter filter = new AFilter();
		System.out.println(filter.procced(abc));
		filter = new BFilter();
		System.out.println(filter.procced(abc));
	}
}

// nasz kod
interface TextFilter {

	@Deprecated
	public String procced(String text);

	public String proccedAndThrow(String text) throws Exception;

}

class AFilter implements TextFilter {

	@Deprecated
	public String procced(String text) {
		return text.replaceAll("a", "");
	}

	public String proccedAndThrow(String text) throws Exception {
		// coś ekstra liczymy
		return text.replaceAll("a", "");
	}
}

class BFilter implements TextFilter {

	@Deprecated
	public String procced(String text) {
		return text.replaceAll("b", "");
	}

	public String proccedAndThrow(String text) throws Exception {
		return procced(text);
	}
}